package com.atguigu.yygh.msm.listener;

import com.atguigu.yygh.common.config.MqConst;
import com.atguigu.yygh.vo.msm.MsmVo;
import org.springframework.amqp.rabbit.annotation.Exchange;
import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.QueueBinding;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

/**
 * @author 杨林
 * @create 2022-11-18 18:37 星期五
 * description:监听医院端向mq中发送的消息
 */
@Component
public class SmsReceiver {

    @RabbitListener(bindings = @QueueBinding(
            value = @Queue(value = MqConst.QUEUE_MSM),
            exchange = @Exchange(value = MqConst.EXCHANGE_DIRECT_MSM),
            key = {MqConst.ROUTING_MSM}
    ))
    public void receiver(MsmVo msmVo){
        //模拟向指定手机号发送通知
        System.out.println("-----------------------------------------------------------");
        System.out.println("手机号：" + msmVo.getPhone() + "短信内容为：" + msmVo.getParam().get("message"));
    }

}
